<!DOCTYPE html>
<html>
<head>
<title>req_assign</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />

<link rel="stylesheet" type="text/css"
	href="/codebase/fonts/font_roboto/roboto.css" />
<link rel="stylesheet" type="text/css" href="/codebase/dhtmlx.css" />
<script type="text/javascript" src="/codebase/dhtmlx.js" />
<style>
div#simpleLog {
	height: 200px;
	font-family: Roboto, Arial, Helvetica;
	font-size: 14px;
	color: #404040;
	overflow: auto;
}



</style>
<script>
		
	var customCss = {
		video_bitrate : "validate_magenta",
		video_codec : "validate_orange"
	};
	
	function doOnLoad() {		
		//form_req_reject_details
		//formStructure=null;
		//formStructure=[
					   
		//	               ];
		/*
		if (myForm2) {
			myForm2.unload();
			myForm2 = null;
		}
		*/
		//form_reject_reason=new dhtmlXForm("form_req_reject_details");
		//form_reject_reason.loadStruct(formStructure);
		
		
		
		// button setup
		formStructure2=null;
		formStructure2=[	
						{type:'block',list:[
						                    {type:"hidden",name:"id",  label:"test_id", position:"label-left",inputWidth:"500" },
						                    {type:"newcolumn"},						                   
						                    {type: "select", name: "reason_select", label: "请选择退回原因", inputWidth:"150",options:[
						                                                             						{value: "", text: ""},
						                                                             						{value: "非本中心测试项目", text: "非本中心测试项目"},
						                                                             						{value: "流程不通", text: "流程不通"},
						                                                             						{value: "环境异常", text: "环境异常"},
						                                                             						{value: "缺陷多", text: "缺陷多"},						                                                             						
						                                                             						{value: "其他原因", text: "其他原因"}
						                     ]},
						                    {type:"newcolumn"},
						                    {type:"input",name:"other_reason",disabled:"true", label:"请录入其它原因", position:"label-left",inputWidth:"400" }
						]},
						{type:'block',list:[
				               {type:"button",name:"assign_btn1",value:"确定"}
				             //  {type:"newcolumn"},
				            //   {type:"button",name:"assign_btn2",value:"取消"}
				               ]}
			             ];
		/*
		if (my_form2) {
			my_form2.unload();
			my_form2 = null;
		}*/		
		my_form2=new dhtmlXForm("form_btn");
		my_form2.loadStruct(formStructure2);
		
		my_form2.attachEvent("onChange", function (name, value){
		     if(name == "reason_select"){
		    	 if(value == "其他原因"){
		    		 my_form2.setRequired("other_reason",true);
		    		 my_form2.enableItem("other_reason");
		    	 }else{
		    		 my_form2.setRequired("other_reason",false);
		    		 my_form2.disableItem("other_reason");
		    		 my_form2.setItemValue("other_reason","");
		    	 }
		     }
		});
		
		my_form2.attachEvent("onButtonClick", function(name) {		
			
			if(name=="assign_btn1"){
				var v=document.getElementById("assign_test_id").innerHTML;
				my_form2.setItemValue("id", v);
				this.send("/test/test_reject_save",callback);
				//alert("确定退回成功");	
			}else{				
				alert("取消成功");
				var id = "req_assign_window";
				//var myWins =new dhtmlXWindows();
				myWins.window(id);
				myWins.close();
				
				//myWins.
			}			

		});		
	}	
	
	function callback(){				
		if (arguments[1]=="true"){
			alert("退回需求成功");
			//parent.parent[1].dhxWins2.window("return_req_window").close();
			document.getElementById("is_close_parent_window").innerHTML="true";
			parent.dhxWins2.window("return_test_window").close();
			
			//window.location.pathname="index";
		}else{
			alert("退回需求失败！callback : "+arguments[1]);
		}
	}
	
	
</script>
</head>
<body onload="doOnLoad();">
<div id="assign_test_id" name="assign_test_id" th:text="${test_id}"  style="display: none;"> </div>
<div id="is_close_parent_window" name="is_close_parent_window"  style="display: none;"> </div>
	<table>
		<tr>
			<td>
				<div id="form_req_reject_details" ></div>
			</td>
		</tr>
	</table>		

	<table>
		<tr>
			<td>
				<div id="form_btn" style="padding-left: 50px;"></div>
			</td>
		</tr>
		
	</table>
</body>
</html>